#!/usr/bin/env python 
# -*- coding:utf-8 -*-
"""
@Time:2022/3/14 下午8:34"
@Author:lydia_liu"
@File:litemall.py
@function:
"""
from litemallApiPrac.api_objects.base_api import BaseApi

"""公共业务封装"""
class Litemail(BaseApi):

    def __init__(self):
        self.base_url = "http://litemall.hogwarts.ceshiren.com/"
        self.token = self.get_token()

    def get_token(self):
        # url=' http://litemall.hogwarts.ceshiren.com/admin/auth/login'
        info = {
            "url":f"{self.base_url}/admin/auth/login",
            "method":"POST",
            "json":{
                "username": "admin123",
                "password": "admin123"
            }
        }
        r = self.do_request(info)
        # print(r.json()["data"]["token"])
        return r.json()["data"]["token"]